using System.IO;

public class BaseStream : MemoryStream
{
	public virtual string ReadString()
	{
		int num = ReadInt();
		byte[] array = new byte[num];
		Read(array, 0, num);
		return BytesConverter.BytesToString(array);
	}

	public virtual double ReadDouble()
	{
		byte[] array = new byte[8];
		Read(array, 0, 8);
		return BytesConverter.BytesToDouble(array);
	}

	public virtual int ReadInt()
	{
		byte[] array = new byte[4];
		Read(array, 0, 4);
		return BytesConverter.BytesToInt(array);
	}

	public new virtual byte ReadByte()
	{
		return (byte)base.ReadByte();
	}

	public virtual byte[] ReadBytes(int len)
	{
		byte[] array = new byte[len];
		Read(array, 0, array.Length);
		return array;
	}

	public virtual bool ReadBool()
	{
		return BytesConverter.BytesToBool(ReadByte());
	}

	public virtual long ReadLong()
	{
		byte[] array = new byte[8];
		Read(array, 0, 8);
		return BytesConverter.BytesToLong(array);
	}

	public virtual void Write(long value)
	{
		Write(BytesConverter.GetBytes(value));
	}

	public virtual void Write(byte[] array)
	{
		Write(array, 0, array.Length);
	}

	public virtual void Write(bool value)
	{
		Write(BytesConverter.GetBytes(value));
	}

	public virtual void Write(int value)
	{
		Write(BytesConverter.GetBytes(value));
	}

	public virtual void Write(double value)
	{
		Write(BytesConverter.GetBytes(value));
	}

	public virtual void Write(string value)
	{
		byte[] bytes = BytesConverter.GetBytes(value);
		Write(bytes.Length);
		Write(bytes);
	}
}
